<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="Content-Security-Policy"
          content="default-src *; script-src * 'unsafe-eval' 'unsafe-inline'; connect-src *; img-src * data:; style-src * 'unsafe-inline' ; media-src *;">
    <meta http-equiv="Access-Control-Allow-Origin" content="*"/>
    <meta name="format-detection" content="telephone=no">
    <meta name="msapplication-tap-highlight" content="no">
    <meta name="viewport"
          content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">


    <title>简言</title>

    <!--common框架样式-->
    <link rel="stylesheet" type="text/css" href="css/lib/kendo.mobile.all.min.css"/>
    <link rel="stylesheet" href="css/lib/swiper.min.css">
    <link rel="stylesheet" type="text/css" href="css/lib/android_toast.css"/>
    <link rel="stylesheet" type="text/css" href="css/lib/mobiscroll.css"/>
    <link rel="stylesheet" type="text/css" href="css/lib/mui/mui.min.css"/>
    <link rel="stylesheet" type="text/css" href="css/lib/font-awesome.min.css">
    <link rel="stylesheet" type="text/css" href="css/lib/froala_editor.min.css"/>


    <!--common-->
    <link rel="stylesheet" type="text/css" href="css/app.css"/>
    <link rel="stylesheet" type="text/css" href="css/common.css"/>

    <!--首页-->
    <link rel="stylesheet" type="text/css" href="css/index.css"/>

    <!--发现-->
    <link rel="stylesheet" href="css/find/index.css"/>

    <!--编辑-->
    <link rel="stylesheet" href="css/wirte/index.css"/>


    <!--消息-->
    <link rel="stylesheet" type="text/css" href="css/message/index.css"/>
    <link rel="stylesheet" type="text/css" href="css/message/show.css"/>

    <!--user-->
    <link rel="stylesheet" type="text/css" href="css/user/index.css">
    <link rel="stylesheet" type="text/css" href="css/user/show.css">
    <link rel="stylesheet" type="text/css" href="css/user/login.css">
    <link rel="stylesheet" type="text/css" href="css/user/register.css">
    <link rel="stylesheet" type="text/css" href="css/user/edit.css">

    <!--setting-->
    <link rel="stylesheet" href="css/setting/index.css"/>
    <link rel="stylesheet" href="css/setting/safe.css"/>

</head>
<body>
<div data-role="view"
     ﻿ data-show="onShowIndex" data-hide="onHideIndex"
     data-disable-swipe-backward="true" data-layout="footer_tab" id="index" data-title="首页">
    <header data-role="header">
        <div data-role="navbar">
            <a href="javascript:void(0)" data-align="left" class="follow">全部关注</a>
        </div>
    </header>


    <!--显示内容-->
    <div class="content" id="content">
        <div id="slider" class="mui-slider mui-fullscreen">
            <div class="mui-slider-group">
                <div id="item1mobile" class="mui-slider-item mui-control-content mui-active">
                    <div id="scroll1" class="mui-scroll-wrapper">
                        <div class="mui-scroll">

                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>


    <!--选择只看项目菜单-->
    <div class="menu-backdrop">
        <div class="popup_menu_follow">
            <ul class="list">
                <li class="item" value="0"><span>全部关注</span></li>
                <li class="item" value="1"><span>只看专题</span></li>
                <li class="item" value="2"><span>只看文章</span></li>
                <li class="item" value="3"><span>只看用户</span></li>
                <li class="item" value="4"><span>只看推送更新</span></li>
            </ul>
        </div>
    </div>

</div>

<!--common_view-->
<!--header-->
<div data-role="layout" data-id="header_comm">
    <header data-role="header" class="index_header">
        <div data-role="navbar">
            <a data-role="backbutton" data-align="left" class="btn-back"></a>
            <span data-role="view-title"></span>
        </div>
    </header>
</div>

<!--footer-->
<div data-role="layout" data-id="footer_tab">
    <footer data-role="footer" class="index_footer_tab">
        <div class="tab-bar flex-h">
            <a class="tab-item active flex1">
                <span class="icon index"></span>
                首页
            </a>
            <a class="tab-item flex1">
                <span class="icon find"></span>
                发现
            </a>
            <a class="tab-item flex1 wirte">
                <span class="icon wirte"></span>
            </a>
            <a class="tab-item flex1">
                <span class="icon msg"></span>
                消息
            </a>
            <a class="tab-item flex1">
                <span class="icon my"></span>
                我的
            </a>
        </div>
    </footer>
</div>


<!--获取照片-->
<div id="ui-popup-menu" style="display: none;">
    <div class="menu">
        <ul>
            <li>
                <a href="#!" data-role="link">拍照</a>
            </li>
            <li>
                <a href="#!" data-role="link">从手机相册中选择</a>
            </li>
        </ul>
    </div>
</div>

<!--common框架-->
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/lib/jquery.js"></script>
<script type="text/javascript" src="js/lib/jquery.ex.js"></script>
<script type="text/javascript" src="js/lib/kendo.mobile.js"></script>
<!--<script type="text/javascript" src="js/lib/kendo.toolbar.js"></script>-->
<!--<script type="text/javascript" src="js/lib/kendo.mobile.ex.js"></script>-->
<script type="text/javascript" src="js/lib/android_toast.js"></script>
<script type="text/javascript" src="js/lib/jquery-ui.js"></script>
<script type="text/javascript" src="js/lib/mobiscroll.js"></script>
<script type="text/javascript" src="js/lib/jquery.marquee.js"></script>
<script type="text/javascript" src="js/lib/area.js"></script>
<script type="text/javascript" src="js/lib/mui/mui.min.js"></script>
<script type="text/javascript" src="js/lib/swiper.js"></script>
<script type="text/javascript" src="js/lib/sockjs-0.3.min.js"></script>
<script type="text/javascript" src="js/lib/reconnecting-websocket.min.js"></script>
<script type="text/javascript" src="js/lib/froala_editor.min.js"></script>
<!--百度地图-->
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=ThUVQagDsiZ8lAl4phkx68AxKLlYGSoo"></script>
<script type="text/javascript" src="js/lib/jquery.fly.min.js"></script>
<script type="text/javascript" src="js/lib/jquery.lazyload.min.js"></script>

<!--common-->
<script type="text/javascript" src="js/app.js"></script>
<script type="text/javascript" src="js/session.js"></script>
<script type="text/javascript" src="js/pub.js"></script>
<script type="text/javascript" src="js/backservice.js"></script>


<!--首页-->
<script type="text/javascript" src="js/lib/mui/mui.pullToRefresh.js"></script>
<script type="text/javascript" src="js/lib/mui/mui.pullToRefresh.material.js"></script>
<script type="text/javascript" src="js/index.js"></script>


<!--发现-->
<script type="text/javascript" src="js/find/backservice.js"></script>
<script type="text/javascript" src="js/find/index.js"></script>

<!--编辑信息-->
<script src="js/wirte/backservice.js" type="text/javascript" charset="utf-8"></script>
<script src="js/wirte/index.js" type="text/javascript" charset="utf-8"></script>

<!--消息-->
<script type="text/javascript" src="js/message/backservice.js"></script>
<script type="text/javascript" src="js/message/index.js"></script>
<script type="text/javascript" src="js/message/show.js"></script>

<!--我的-->
<script type="text/javascript" src="js/user/backservice.js"></script>
<script type="text/javascript" src="js/user/index.js"></script>
<script type="text/javascript" src="js/user/show.js"></script>
<script type="text/javascript" src="js/user/login.js"></script>
<script type="text/javascript" src="js/user/register.js"></script>


<!--setting-->
<script src="js/setting/backservice.js" type="text/javascript" charset="utf-8"></script>
<script src="js/setting/index.js" type="text/javascript" charset="utf-8"></script>
<script src="js/setting/safe.js" type="text/javascript" charset="utf-8"></script>

<script type="text/javascript" src="js/test_local.js"></script>


<script>
    app.initialize();

    var inBrowser = location.href.substr(0, 5) == 'http:';

    function onFooterButtonClick() {
        kendoApp.view().trigger('footerButtonClicked');
    }

    var kendoApp = new kendo.mobile.Application(document.body, {
        transition: null,
        skin: 'flat',
        pushState: false,
        layout: 'default',
        root: 'view',
        loading: '<h1>正在加载...</h1>',
//        initial: '#user/login.html',
//        useNativeScrolling: true,

        init: function () {
            setTimeout(function () {
                var view = kendoApp.view();
                if (!view || view.element.attr('id') != 'index') {
                    $('#init_cover').hide();
                }
            }, 0);
        }
    });

    $(document).on('view-change', function () {
        for (var n = 0; n < backService.requests.length; n++) {
        }
    });


    $(document).on('navigateBack', function (e, url) {
        if (kendoApp.view().trigger('navigateBack', {to: url})) {
            alert('no back!');
        }
    });

    //ƒ
    window.viewLinkClickInterceptor = function (view, a, e) {
        if (backService.requests.length && view.disableViewOnBackServiceLoading !== false) {
            return false;
        }
    };


    // 滑动后退前进
    window.viewInitInterceptor = function (view) {
        view.content.kendoTouch({
            enableSwipe: true,
            swipe: function (e) {
                if (e.direction == "left") {

                } else if (e.direction == "right") {
                    if (!view.element.data('disableSwipeBackward')) {
                        if (location.href.indexOf("user/login.html")) {
                            kendoApp.pane.transition = 'slide:right';
                            // history.back();
                            kendoApp.navigate("#:back");
                        }

                    }
                }
            }
        });
    };


    window.addEventListener('native.keyboardshow', keyboardShowHandler);
    window.addEventListener('native.keyboardhide', keyboardHideHandler);

    var lastAdjustedScroller;

    function scrollElInputIntoView(el) {
        var scroller = app.getContainingWidget(el, 'kendoMobileScroller');
        if (scroller) {
            var $scroller = $(scroller.element);
            var scrollerTop = $scroller.offset().top;
            var scrollerBottom = scrollerTop + $scroller.height();
            var elTop = $(el).offset().top;
            var elBottom = elTop + $(el).outerHeight();
            var dy = elBottom - scrollerBottom;
//            el.scrollIntoView();
            var scrollerScrollTop = scroller.scrollTop;
            if (scrollerScrollTop === undefined) {
                scrollerScrollTop = scroller.element.scrollTop();
            }
            scroller.lastScrollTop = scrollerScrollTop;
            var y = -(scrollerScrollTop || 0) - dy - 12;

            scroller.scrollTo(undefined, y);
            lastAdjustedScroller = scroller;
        }
        else {
            el.scrollIntoView();
        }
    }

    function keyboardHideHandler(e) {
        var scroller = lastAdjustedScroller;
        if (scroller && scroller.lastScrollTop !== undefined) {
            lastAdjustedScroller = null;
            setTimeout(function () {
                scroller.scrollTo(undefined, -scroller.lastScrollTop);
                delete scroller.lastScrollTop;
            }, 300);
        }
    }

    function keyboardShowHandler(e) {
        var el = document.activeElement;
        var tagName = el.tagName;
        if ((tagName == 'INPUT' || tagName == 'TEXTAREA' ) &&
            $(el).offset().top > $(window).height()) {
//            alert('..');
            setTimeout(function () {
                //el.scrollIntoView();
                scrollElInputIntoView(el);
            }, 10);
        }
    }


    if (inBrowser) {
        (function () {
            var timerId;
            window.addEventListener('resize', function () {
                clearTimeout(timerId);
                timerId = setTimeout(keyboardShowHandler, 200);
            });
        })();
    }

</script>
</body>
</html>
